<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <title>仓储信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/staff/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/staff/layout/css/font_eolqem241z66flxr.css" media="all" />
    <style type="text/css">
   td{
  text-align: center;
    }
    </style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search" style="margin-top:1.2em;">
     <div class="layui-inline" style="width: 70px;height: 70px;background: #2fa89d;border-radius: 50%"><img src="/staff/storage/img/cc.png" style="margin-top:6px;margin-left: 10px;"></div>
    <div class="layui-inline" style="color: #f27053">
     <a class="layui-btn linksAdd_btn" style="background-color:#1aa094;"> <img src="/staff/storage/img/tj2.png" style="margin-right: 10px;height: 36px;margin-bottom: 2px;">添加仓储信息</a>
    </div>
</blockquote>
<div class="layui-form links_list">
    <table class="layui-table">
        {{csrf_field()}}
        <thead>
        <tr>
            <th style="text-align: center;">ID</th>
            <th style="text-align: center;">名称</th>
            <th style="text-align: center;">房间</th>
            <th style="text-align: center;">房间位置</th>
            <th style="text-align: center;">模组</th>
            <th style="text-align: center;">设备类型</th>
            <th style="text-align: center;">操作</th>

        </tr>
        </thead>
        <tbody class="links_content">
        @if(!empty($data))
            @foreach($data as $val)
                <tr id="storage_{{$val['id']}}">
                    <td >{{$val['id']}}</td>
                    <td style="color:#94824c">{{$val['name']}}</td>
                    <td style="color:#1200ff;">{{$val['rname']}}</td>
                    <td style="color:#466f6d">{{$val['loc']}}</td>
                    <td style="color:#ff00af">{{$val['verifyCode']}}</td>
                    <td style="color:#2e292f">{{$val['type_name']}}</td>
                    
                    <td>
                        <a class="layui-btn layui-btn-mini links_edit" storage="{{$val['id']}}"><i class="iconfont icon-edit"></i> 编辑</a>
                        <a class="layui-btn layui-btn-danger layui-btn-mini links_del" data-id="1" onclick="delStorage({{$val['id']}})"><i class="layui-icon"></i> 删除</a>
                    </td>
                </tr>
            @endforeach
        @endif
        </tbody>
    </table>
</div>

<script type="text/javascript" src="/staff/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/staff/layui/layui.js"></script>
<script type="text/javascript" src="/staff/storage/js/storage.js"></script>
<script>
    function delStorage(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/staff/storage/destroy',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#storage_'+id).remove();
                        layer.msg('删除成功！',{time:800});
                        // parent.location.reload();
                        layer.close(index);
                    }else{
                        layer.msg('删除失败！',{time:800});
                        layer.close(index);
                    }
                }

            })
            layer.close(index);
        });
    }
</script>
</body>
</html>